<extend name="Public/common" />
<block name="body">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>角色列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-5 m-b-xs">
                            <a href="{:U('role/addRole')}">
                                <button class="btn btn-primary btn-sm" type="button"><i class="fa fa-plus-square"></i>&nbsp;&nbsp;添加角色</button>
                            </a>
                        </div>
                        <div class="col-sm-3" style="float: right;">
                            <!-- <div class="input-group">
                                <input type="text" placeholder="请输入角色名称" class="input-sm form-control"> <span class="input-group-btn">
                                <button type="button" class="btn btn-sm btn-primary"> 搜索</button> </span>
                            </div> -->
                        </div>
                    </div>
                    <div class="table-responsive">
                        <table class="table table-striped">
                            <thead>
                            <tr>
                                <!--<th></th>-->
                                <th>ID</th>
                                <th>角色名称</th>
                                <th>状态</th>
                                <th>创建时间</th>
                                <th>修改时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <volist name="rolelist" id="rolelist">
                                <tr>
                                    <!--<td>
                                        <input type="checkbox" class="i-checks" name="id[]" value="{$rolelist.id}">
                                    </td>-->
                                    <td>{$rolelist.id}</td>
                                    <td>{$rolelist.name}</td>
                                    <td>
                                        <if condition="($rolelist['status'] eq 0)"><span style="color: green">启用</span></if>
                                        <if condition="($rolelist['status'] eq 1)"><span style="color: red">禁用</span></if>
                                    </td>
                                    <td>
                                        {$rolelist.create_time|date="Y-m-d H:i:s",###}
                                    </td>
                                    <td>
                                        <if condition="($rolelist['update_time'] eq '')">
                                            暂无记录
                                            <else/>
                                            {$rolelist.create_time|date="Y-m-d H:i:s",###}
                                        </if>
                                    </td>
                                    <if condition="($rolelist['id'] neq 1)">
                                        <td>
                                            <if condition="$rolelist['status'] eq 0">
                                                <a href="{:U('Role/setStatus',['id'=>$rolelist['id'],'tableName'=>'Role','status'=>1])}" class="ajax-status"><button type="button" class="btn btn-outline btn-danger btn-xs">禁用</button></a>
                                                <else/>
                                                <a href="{:U('Role/setStatus',['id'=>$rolelist['id'],'tableName'=>'Role','status'=>0])}" class="ajax-status"><button type="button" class="btn btn-outline btn-primary btn-xs">启用</button></a>
                                            </if>

                                            <a href="{:U('role/editrole',['id'=>$rolelist['id']])}"><button type="button" class="btn btn-outline btn-default btn-xs">授权</button></a>
                                            <a href="{:U('role/delete',['id'=>$rolelist['id'],'tableName'=>'Role'])}" class="ajax-delete"><button type="button" class="btn btn-outline btn-warning btn-xs">删除</button></a>
                                        </td>
                                    <else/>
                                        <td>
                                            <span style="color: red;">不能操作超级管理员</span>
                                        </td>
                                    </if>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                    <div style="text-align: center;">{$page}</div>
                </div>
            </div>
        </div>

    </div>
</div>
<script src="__JS__/http/ajax.js"></script>
</block>